﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using FreedBack.Core.Entities;

namespace Freedback.Core.Context
{
    public class FreedbackContextInitializer : DropCreateDatabaseIfModelChanges<FreedbackContext>
    {
        protected override void Seed(FreedbackContext context)
        {
            var feedbackTypes = new List<FeedbackType>
                {
                    new FeedbackType{Id = (int)IdentificationEnums.FeedbackTypes.Compliment, Name="Compliment"},
                    new FeedbackType{Id = (int)IdentificationEnums.FeedbackTypes.Suggestion, Name="Suggestion"},
                    new FeedbackType{Id = (int)IdentificationEnums.FeedbackTypes.Issue, Name="Issue"},
                    new FeedbackType{Id = (int)IdentificationEnums.FeedbackTypes.Question, Name="Question"}
                };
            foreach (var item in feedbackTypes)
            {
                context.FeedbackTypes.Add(item);
            }
            context.SaveChanges();

            var areasOfFeedback = new List<AreaOfFeedback>
                {
                    new AreaOfFeedback{Id = (int)IdentificationEnums.AreasOfFeedback.CurrentScreen, Name="The screen I am on right now"},
                    new AreaOfFeedback{Id = (int)IdentificationEnums.AreasOfFeedback.WholeSite, Name="The whole site in general"},
                    new AreaOfFeedback{Id = (int)IdentificationEnums.AreasOfFeedback.Other, Name="Other (I will describe the area myself)"}
                };
            foreach (var item in areasOfFeedback)
            {
                context.AreasOfFeedback.Add(item);
            }
            context.SaveChanges();

            var ratingValues = new List<RatingValue>
                {
                    //Compliment ratings
                    new RatingValue{Value = (int)IdentificationEnums.RatingValueActualValue.Low, Name = "Not at all"},
                    new RatingValue{Value = (int)IdentificationEnums.RatingValueActualValue.LowToMid, Name = "Not very strongly"},
                    new RatingValue{Value = (int)IdentificationEnums.RatingValueActualValue.Medium, Name = "Somewhat strongly"},
                    new RatingValue{Value = (int)IdentificationEnums.RatingValueActualValue.MidToHigh, Name = "Quite strongly"},
                    new RatingValue{Value = (int)IdentificationEnums.RatingValueActualValue.High, Name = "Extremely strongly"}
                };
            foreach (var item in ratingValues)
            {
                context.RatingValues.Add(item);
            }

            context.SaveChanges();
        }
    }
}